package com.lxyk.service.monthly.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lxyk.dao.monthly.StuTestDao;
import com.lxyk.domain.StuTest;
import com.lxyk.service.monthly.StuTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName StuTestServiceImpl
 * @Description TODO
 * @Author FJQ
 * @Date 2022/4/9 21:00
 * @Version 1.0
 **/
@Service
public class StuTestServiceImpl implements StuTestService {

    @Autowired
    private StuTestDao stuTestDao;


    @Override
    public Integer addBatchStuTest(List<StuTest> list) {
        return stuTestDao.insertBatchStuTest(list);
    }

    @Override
    public PageInfo<StuTest> selectAllById(Map map,Integer pageNum, Integer pageSize) {
        pageNum = pageNum != null ? pageNum : 1;
        pageSize = pageSize != null ? pageSize : 10;
        PageHelper.startPage(pageNum, pageSize);
        List<StuTest> stuTestList = stuTestDao.selectAllById(map);
        return new PageInfo(stuTestList);
    }


    @Override
    public Integer modifyOne(StuTest stuTest) {
        return stuTestDao.updateOne(stuTest);
    }

    @Override
    public PageInfo<StuTest> queryAllByName(Map map,Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<StuTest> stuTestList = stuTestDao.selectAllByName(map);
        return new PageInfo(stuTestList);
    }



}
